package com.rocpenghua.design.flyweight;

/**
 * @author pengp
 * @date 2023年02月22日 15:10
 */
public class MainTest {
    public static void main(String[] args) {
        FlyweightFactory flyweightFactory = new FlyweightFactory();
        IFlyweight flyweight1 = flyweightFactory.getFlyweight("A");
        IFlyweight flyweight2 = flyweightFactory.getFlyweight("B");
        IFlyweight flyweight3 = flyweightFactory.getFlyweight("A");
        flyweight1.print();
        flyweight2.print();
        flyweight3.print();
        System.out.println(flyweightFactory.getFlyweightMapSize());
    }
}
/**
 * Flyweight.id = A ...
 * Flyweight.id = B ...
 * Flyweight.id = A ...
 * 2
 */